package com.xqboss.apps.dto.user;

import com.xqboss.apps.dto.PageDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Objects;


/**
 * 用户段位升级记录(UserRankUpgradeRecord)表实体类
 *
 * @author makejava
 * @since 2023-12-05 12:05:24
 */
@Data
@Builder
public class UserRankUpgradeRecordDto extends PageDto {
    //用户id
    @ApiModelProperty("用户ID")
    @NotNull(message = "用户ID不能为空！")
    private Long userId;
    @ApiModelProperty("升段前身份全称")
    private String preRankFullName;
    @ApiModelProperty("升段后身份全称")
    private String postRankFullName;
    @ApiModelProperty("升段消耗资源内容")
    private String resourceCost;
    @ApiModelProperty("升级时间")
    private LocalDateTime upgradeTime;
    @ApiModelProperty("开始时间")
    private LocalDateTime createTimeStart;
    @ApiModelProperty("结束时间")
    private LocalDateTime createTimeEnd;

    public LocalDateTime getCreateTimeEnd() {
        if(Objects.nonNull(createTimeEnd)){
            return createTimeEnd.with(LocalTime.MAX);
        }
        return createTimeEnd;
    }
    }

